home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0072_VIDEO MODE.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-26  |  1KB  |  42 lines

  1. {
  2. How can I save and restore the text screen mode (e.g. 132*28 characters)
  3. when using BGI calls in a Turbo Pascal program ?
  4. Unfortunately I always have 80*25 after program exit.
  5. }
  6.  
  7. function get_video_mode : byte;
  8. { Returns the current video mode (from interrupt $10,$f).
  9.   Byte [$40:$49] also contains this information, but might not always
  10.   have the correct value.
  11. }
  12.  
  13. var
  14.   check_b : byte; {video mode byte : absolute $40:$49}
  15.  
  16. begin {get_video_mode}
  17.   asm
  18.     mov ah, 0fh
  19.     int 10h
  20.     mov check_b, al
  21.   end;
  22.   if check_b > 127
  23.     then get_video_mode:=check_b-128  {last mode change was done without
  24.                                        screen clearing, mode is given by the
  25.                                        low 7 bits}
  26.     else get_video_mode:=check_b;
  27. end; {get_video_mode}
  28.  
  29.  
  30. procedure set_video_mode(m : byte);
  31. { Sets the given video mode (via interrupt $10,0).
  32.   If high bit is on screen is not cleared (works only for text modes?).
  33. }
  34.  
  35. begin {set_video_mode}
  36.   asm
  37.     mov ah, 00h
  38.     mov al, m
  39.     int 10h
  40.   end;
  41. end; {set_video_mode}
  42.